<template>
	<view class="all">
		<button class="fanhui" @click="fanhui" type="primary"></button>
		<image class="touxiang" src="@/static/logo.png"></image>
		<view class="zhang">{{zhang}}</view>
		<view class="dengji">(lv:{{user.dengji}})</view>
		<view class="shenglv">
			<view class="quanbuchangci">全部场次:{{user.quanbuchangci}}</view>
		    <view class="shengchang">胜场:{{user.shengchang}}</view>
		</view>
		<view class="wanjiapaiming">玩家排名:{{paiming}}</view>
		<view class="jifen">当前积分:{{user.jifen}}</view>
		<view class="gonghui">公会:{{user.gonghui}}</view>
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				zhang:'',
				user:{},
				paihangbang:[],
				paiming:0
				
			}
		},
		onLoad(){
		this.zhang=getApp().globalData.zhang	
	    this.xinxi()
		},
		methods: {
			fanhui(){
				uni.redirectTo({
					url:"/pages/index/shezhi/shezhi"
				})
			},
			async xinxi(){
				uni.request({
					url:"http://124.221.104.5:8080/jbgn/chagerenxinxi",
					data:{zhang:this.zhang},
					success: (res) => {
						this.user=res.data
					}
				})
				uni.request({
					url:"http://124.221.104.5:8080/jbgn/paihangbang",
					success: (res) => {
						this.paihangbang=res.data
					}
				})
				await new Promise((res)=>setTimeout(res,500))
				this.paihangbang.forEach((mingzi,index)=>{
					 if(mingzi.zhang==this.zhang)
					   this.paiming=index+1
					   console.log(mingzi)
				})
				
				
			}
			
		}
	}
</script>

<style>
.all{
	display: flex;
	flex-direction: column;
	align-items: center;
}
.fanhui{
	width: 30rpx;
	height: 30rpx;
}
.touxiang{
		margin-top: 100rpx;
		width: 300rpx;
		height: 300rpx;
		border-radius: 100%;
	}
	.zhang{
		margin-top: 10rpx;
		font-size: 85rpx;
		
	}
	.dengji{
		margin-top: -20rpx;
		font-size: 50rpx;
	}
	.shenglv{
		margin-top: 40rpx;
		display: flex;
		flex-direction: row;
		align-items: center;
		font-size: 50rpx;
		border: 1rpx solid aqua;
		width: 100%;
		text-align:center;
		height: 90rpx;
		line-height: 90rpx;
	}
	.quanbuchangci{
		margin-left: 100rpx;
	}
	.shengchang{
		margin-left: 50rpx;
	}
	.wanjiapaiming{
		margin-top: 50rpx;
			font-size: 50rpx;
		border: 1rpx solid aqua;
		width: 100%;
		text-align: center;
		height: 90rpx;
		line-height: 90rpx;
	}
	.jifen{
		margin-top: 50rpx;
		font-size: 50rpx;
	border: 1rpx solid aqua;
	width: 100%;
	text-align: center;
	height: 90rpx;
	line-height: 90rpx;
	}
	.gonghui{
		margin-top: 50rpx;
		border: 1rpx solid aqua;
		border: 1rpx solid aqua;
		width: 100%;
		font-size: 50rpx;
		text-align: center;
		height: 90rpx;
		line-height: 90rpx;
	}
</style>
